package cz.zcu.fav.rat.dataaccess.service;


import java.util.Collection;
import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import cz.zcu.fav.rat.dataaccess.dao.GenericDAO;

@Transactional
public interface GenericDataAccessService<T, DAO extends GenericDAO<T, Integer>>
{	
	/** Persist the newInstance object into database */
	@Transactional(readOnly=false)
	Integer create(T newInstance);

	
	/** Save changes made to a persistent object. */
	@Transactional(readOnly=false)
	void update(T transientObject);

	/** Remove an object from persistent storage in the database */
	@Transactional(readOnly=false)
	void delete(T persistentObject);
	
	@Transactional(readOnly=true)
	List<T> getAll();
	
	@Transactional(readOnly=false)
	void saveOrUpdate(T persistentObject);

	@Transactional(readOnly=true)
	T get(Integer id);
	
	@Transactional(readOnly=false)
	T merge(T object);
	
	@Transactional(readOnly=false)
	void deleteCollection(Collection<T> data);
}
